package no.gnet.edvd.lightweight;

import java.util.List;

import no.gnet.edvd.types.Player;
import no.gnet.edvd.types.Transfer;
import no.gnet.edvd.types.Wallet;

public class SessionState {
	private boolean loggedon;
	private Player player;
	Wallet wallet;
	List <Transfer> unpaidTransfers;
	
	public SessionState(){
		
	}

	public SessionState(boolean l, Player p, Wallet wallet, List <Transfer> unpaidTransfers) {
		this.loggedon=l;
		this.player=p;
		this.wallet=wallet;
		if(wallet!=null){
			assert(wallet.playerid==player.id);
		}
		this.unpaidTransfers=unpaidTransfers;
	}


	public boolean isLoggedon() {
		return loggedon;
	}


	public void setLoggedon(boolean loggedon) {
		this.loggedon = loggedon;
	}


	public Player getPlayer() {
		return player;
	}


	public void setPlayer(Player player) {
		this.player = player;
	}


	public Wallet getWallet() {
		return wallet;
	}


	public void setWallet(Wallet wallet) {
		this.wallet = wallet;
	}
	
	public boolean isOutstandingTransfers(){
		return unpaidTransfers!=null && unpaidTransfers.size()>0;
	}

	@Override
	public String toString() {
		return "SessionState [loggedon=" + loggedon + ", player=" + player
				+ ", wallet=" + wallet + "]";
	}

	public List<Transfer> getUnpaidTransfers() {
		return unpaidTransfers;
	}
}
